package day07;

import java.util.Scanner;

//猜数字小游戏    while(true)
public class Guessing {
    public static void main(String[] args) {
        System.out.println("随机生成一个1到1000的整数：");
        int guess=(int)(Math.random()*1000+1);
        System.out.println("作弊"+guess);
        while (true){
            Scanner scan=new Scanner(System.in);
            int num=scan.nextInt();
            if(num>guess){
                System.out.println("猜大了");
            }else if( num<guess){
                System.out.println("猜小了");
            }else {
                System.out.println("猜对了");
                break;
            }
        }
    }

}
